<?php
/**
 * 加载Iframe框架
 * @author yaoli<yaoli@pateo.com.cn>
 * @version 1.0 GetUser add by yaoli<yaoli@pateo.com.cn> 
 */
class vhlInfo extends ActionBase1 {
	
	private $_uid = 0;
	private $_vin = 0;
	function init() {
		global $_SGLOBAL;
		$this->_uid = $_SGLOBAL['uid'];
		$this->_vin = $_SGLOBAL['vincode'];
	}
	public function action() {
		
	}
	public function index(){
		$this->template('vhlInfo/index.html');		
	}
	public function getServiceList(){
		$this->template('vhlInfo/getService.html');		
	}
	public function getVehicleInfo(){
		header('content-type:application/json;charset=utf-8');
		$ret = load_model('vms',0)->getVehicleInfo($this->_vin);
		$json = json_decode($ret);
		if( $json && $json->status->code == 200 ){
			echo json_encode($json);	
		}else{
			echo "{code:0,description:'获取数据失败.'}";
		}
	}
	public function updateVehicle(){
		header('content-type:application/json;charset=utf-8');
		$data = $this->data['request']['_data'];
		$ret = load_model('vms',0)->updateVehicle($data);
		echo $ret;
	}
	public function getService(){
		header('content-type:application/json;charset=utf-8');
		$ret = load_model('vms',0)->getService();
		echo $ret;	
	}
	
	public function getContractInfo(){
		$contract = load_model('bcs',0)->getContractInfo();
		header('content-type:application/json;charset=utf-8');		
		echo ($contract);
	}
	
	public function updatepin(){
		
		$status = load_model('bcs',0)->updatepin($this->data['request']['pin']);
		header('content-type:application/json;charset=utf-8');
		echo ($status);
	}
	
}
